Skip to content

🛡️ Sentinel: Fix SSRF bypass and add DoS protection to URL capture#40

Draft
Sumit-5002 wants to merge 1 commit into
mainfrom
sentinel-ssrf-dos-hardening-17698926566135819095
Draft

🛡️ Sentinel: Fix SSRF bypass and add DoS protection to URL capture#40
Sumit-5002 wants to merge 1 commit into
mainfrom
sentinel-ssrf-dos-hardening-17698926566135819095

Conversation

@Sumit-5002

Copy link
Copy Markdown
Owner

This PR addresses a significant security regression in the /api/image/html-to-image endpoint. It robustly implements SSRF protection by:

  1. Disabling automatic redirect following, which could bypass internal IP checks.
  2. Expanding the internal IP blacklist to cover missing ranges (CGNAT, Link-local, Benchmarking).
  3. Implementing DNS rebinding mitigation by fetching via resolved IP while maintaining the Host header.

Additionally, it adds DoS protection by enforcing a 5-second timeout and a 512KB content size limit on the fetched HTML. The associated test suite has been fixed, modernized with DNS mocking, and expanded to cover these new security controls.


PR created automatically by Jules for task 17698926566135819095 started by @Sumit-5002

- Implemented `redirect: 'manual'` in `/html-to-image` to prevent SSRF bypasses via redirects.
- Added a 5-second timeout using `AbortSignal.timeout` for all fetches.
- Enforced a 512KB size limit on fetched HTML content to prevent DoS.
- Expanded the internal IP blacklist to include CGNAT (RFC 6598), Link-local (RFC 3927), and Benchmarking (RFC 2544) ranges.
- Fixed and enhanced `server/routes/image.test.js` to correctly verify SSRF and DoS protections using DNS mocking.
- Updated `.jules/sentinel.md` with new security learnings.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 45ed3b0b-a6c6-41b5-b4d3-2bf75d04fd4a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-ssrf-dos-hardening-17698926566135819095

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant